<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="../jsLib/angular.js"></script>

    <title></title>
</head>
<body  ng-app="app" >
<hello >11111111</hello><br>
<hello  world>dfsadfsdafsd</hello>

<script>
    var app = angular.module('app',[]);
    app.directive('hello',function(){
        return{
            scope:{},
            restrict:"AE",


            controller:function($scope){
                this.alert1=function(){
                    alert(1);
                }
            },
            link:function(scope,element,attr){
                element.on('click',function(){
                    alert('有点难啊！')
                })
            }
        }
    })
    app.directive('world',function(){
        return{

            require:"^hello",

            link:function(scope,element,attr,hello){
                element.on('click',function(){
                    hello.alert1();
                })
            }
        }
    })
</script>
</body>
</html>